public class TestDemo2 {
    public static final Object locker1=new Object();
    public static final Object locker2=new Object();
    public static Object locker3=new Object();
    public static void main(String[] args) {
        Thread a=new Thread(()->{
           synchronized (locker1){
               try {
                   locker1.wait();
               } catch (InterruptedException e) {
                   e.printStackTrace();
               }
           }
            System.out.println("A");
        });
        Thread b=new Thread(()->{
            synchronized (locker2){
                try {
                    locker2.wait();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println("B");
                synchronized (locker1){
                    locker1.notify();
                }

            }
        });
        Thread c=new Thread(()->{
            System.out.println("c");
            synchronized (locker2){
                locker2.notify();
            }

        });
        a.start();
        b.start();
        c.start();
        
    }

}